package com.le.enhance.class5;

import org.junit.Test;

public class Code_01_getHeight {
    
    public static class Node{
        int value;
        Node left;
        Node right;

        public Node(int value) {
            this.value = value;
        }
    }

    public static int process(Node head){
        if (head == null){
            return 0;
        }
        return Math.max(process(head.left),process(head.right)) + 1;
    }

    @Test
    public void test(){
        Node head = new Node(4);
        head.left = new Node(2);
        head.right = new Node(6);
        head.left.left = new Node(1);
        head.left.right = new Node(3);
        head.right.left = new Node(7);
        System.out.println(process(head));
    }
}
